﻿@{
    ViewBag.Title = "View";
}
@using SAD_SiS.ViewModels;
@using SAD_SiS.Models;
@model ShopPagingView
<div class="span3" style="margin-top: 10px; border: 1px solid blue; padding: 10px">
    <h3>
        <a href="@Url.Action("Views", "ShopHome", new { id = @Model.CurrentShop.LinkName }, null)">@Model.CurrentShop.ShopName</a>
    </h3>
    <a href="@Url.Action("Views", "ShopHome", new { id = @Model.CurrentShop.LinkName }, null)">
        <img src="@Url.Content("~/Content/ShopPic/" + @Model.CurrentShop.Logo)" /></a>
    <p style="margin-top: 10px">
        <i>@Model.CurrentShop.Slogan</i></p>
    <h4>
        Thông tin shop
    </h4>
    <p>
        Địa chỉ : @Model.CurrentShop.Address</p>
    <p>
        Điện thoại : @Model.CurrentShop.Phone</p>
</div>
@{
    <div id='book-list' style="margin: 10px 30px 0px 325px;">
        <div id="new-book" class='book-div' style="padding: 20px 25px 5px 5px">
            <div>
                <p class="shopLineHeader">
                    Sản phẩm mới nhất
                    <select id="ddlCate" name="ddlCate" style="width: auto">
                        <option value="0">All</option>
                        @foreach (var item in Model.CategoryList)
                        {
                            if (Model.SelectCate == null)
                            {
                            <option value="@item.CateID">@item.CateName</option>
                            }
                            else
                            {
                            <option value="@item.CateID" selected='@(Model.SelectCate.CateID.Equals(item.CateID) ? "selected" : "")'>@item.CateName</option>    
                            }
                        }
                        }
                    </select></p>
            </div>
            <ul id='first-carousel'>
                @if (Model.ProductList.Count == 0)
                {
                    <h5>
                        Chưa có thông tin</h5>
                }
                else
                {
                    <div id='paging-link'>
                        Trang : @Html.ShopPageLinks(Model, x => Url.Action("Views", new { page = x }))
                    </div>
                    foreach (var i in Model.ProductList)
                    {
                    <li>
                        <div class="thumbnail">
                            <a href="@Url.Action("Details", "Product", new { id = @i.ProductID })">
                                <img src="@Url.Content("~/Content/ProductPic/" + @i.pic)" alt="@i.Name" style="width:140px;height:140px"></a>
                            <div class="caption">
                                <a href="@Url.Action("Details", "Product", new { id = @i.ProductID })">
                                    <h5>
                                        @i.Name</h5>
                                </a><span class="label lblSuccess">@i.SellPrice .000đ</span> <span class="fullprice">@i.Price
                                    .000đ</span>
                            </div>
                        </div>
                    </li>
                    }
                    <div id='paging-link'>
                        Trang : @Html.ShopPageLinks(Model, x => Url.Action("Views", new { page = x }))
                    </div>
                }
            </ul>
        </div>
    </div>
}
<div style="display: none">
    <form action="@Url.Action("Views", "ShopHome")" method="post" id="filter-Form">
    <input type="hidden" id="fID" name="fID" value="@Model.CurrentShop.LinkName"/>
    <input type="hidden" id="fCate" name="fCate" value="" />
    </form>
</div>
@if (false)
{  
    <script src="/Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript">

    </script> 
}
<script type="text/javascript">

    $('#ddlCate').change(function () {
        var str = $('#ddlCate').val();
        $('#fCate').val(str);
        $('#filter-Form').submit();
    })

</script>
